package com.qg.rta.support.mpping;

import com.alibaba.fastjson.JSONObject;
import com.google.gson.JsonObject;
import com.lzs.adx.commmon.utils.JsonUtils;
import com.qg.rta.dto.hw.HwRtaRequest;
import com.qg.rta.dto.request.RtaCommonRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
@Slf4j
public class HwReportMappingStrategy extends AbstractReportParamsMapping{
    @Override
    public RtaCommonRequest adapter(Map<String, Object> params) {
        String jsonString = JSONObject.toJSONString(params);
        HwRtaRequest hwRtaRequest = JSONObject.parseObject(jsonString, HwRtaRequest.class);
        RtaCommonRequest rtaCommonRequest=new RtaCommonRequest();
        rtaCommonRequest.setOaid(hwRtaRequest.getOaid());
        rtaCommonRequest.setRtaId(hwRtaRequest.getRtaId());
        rtaCommonRequest.setIp(hwRtaRequest.getIp());
        rtaCommonRequest.setUa(hwRtaRequest.getUa());
        rtaCommonRequest.setRequestId(hwRtaRequest.getRequestId());
        rtaCommonRequest.setTs(hwRtaRequest.getRequestTime());

        return rtaCommonRequest;
    }
}
